#include "NearestInterpolator.h"
#include "Color.h"
#include <cmath>
#include "ReadableImage.h"

// Construct with edge modes.
NearestInterpolator::NearestInterpolator(EdgeMode horizontal_edge,
                                         EdgeMode vertical_edge)
    : TiledInterpolator(horizontal_edge, vertical_edge) {}

NearestInterpolator::~NearestInterpolator() {}

// Returns color of nearest pixel.
Color NearestInterpolator::pixel(const ReadableImage& image, double i,
    double j) const {
  return access(image, floor(i + 0.5), floor(j + 0.5));
}

